<!DESCRIPTION> Validate dates in your form using this universal script. Will work with any date format and the code is fully commented for easy modification. <!/DESCRIPTION>
<!CATEGORY>Forms<!/CATEGORY>
<!SCRIPT>
<!-- START OF SCRIPT -->
<!-- HOW TO INSTALL VALIDATION (UNIVERSAL DATE):
1. Copy code into the HEAD section of document
2. Put last coding into the BODY section of document -->
<!-- STEP ONE: Add code into HEAD section of document -->
mm (or MM) : month number, strictly two digits (i.e. April is 04).
d (or D) : day number, one or two digits.
dd (or DD) : day number, strictly two digits.
y (or Y) : year, two or four digits.
yy (or YY) : year, strictly two digits.
yyyy (or YYYY) : year, strictly four digits.
mon : abbreviated month name (April is apr, Apr, APR, etc.)
Mon : abbreviated month name, mixed-case (i.e. April is Apr only).
MON : abbreviated month name, all upper-case (i.e. April is APR only).
mon_strict : abbreviated month name, all lower-case (i.e. April is apr
only).
month : full month name (April is april, April, APRIL, etc.)
Month : full month name, mixed-case (i.e. April only).
MONTH: full month name, all upper-case (i.e. APRIL only).
month_strict : full month name, all lower-case (i.e. april only).
h (or H) : hour, one or two digits.
hh (or HH) : hour, strictly two digits.
min (or MIN): minutes, one or two digits.
mins (or MINS) : minutes, strictly two digits.
s (or S) : seconds, one or two digits.
ss (or SS) : seconds, strictly two digits.
ampm (or AMPM) : am/pm setting. Valid values to match this token are
am, pm, AM, PM, a.m., p.m., A.M., P.M.
*/
// Be careful with this pattern. Longer tokens should be placed before shorter
// tokens to disambiguate them. For example, parsing "mon_strict" should
// result in one token "mon_strict" and not two tokens "mon" and a literal
// "_strict".
var tokPat=new RegExp("^month_strict|month|Month|MONTH|yyyy|YYYY|mins|MINS|mon_strict|ampm|AMPM|mon|Mon|MON|min|MIN|dd|DD|mm|MM|yy|YY|hh|HH|ss|SS|m|M|d|D|y|Y|h|H|s|S");
// lowerMonArr is used to map months to their numeric values.
mm (or MM) : month number, strictly two digits (i.e. April is 04).
d (or D) : day number, one or two digits.
dd (or DD) : day number, strictly two digits.
y (or Y) : year, two or four digits.
yy (or YY) : year, strictly two digits.
yyyy (or YYYY) : year, strictly four digits.
mon : abbreviated month name (April is apr, Apr, APR, etc.)
Mon : abbreviated month name, mixed-case (i.e. April is Apr only).
MON : abbreviated month name, all upper-case (i.e. April is APR only).
mon_strict : abbreviated month name, all lower-case (i.e. April is apr
only).
month : full month name (April is april, April, APRIL, etc.)
Month : full month name, mixed-case (i.e. April only).
MONTH: full month name, all upper-case (i.e. APRIL only).
month_strict : full month name, all lower-case (i.e. april only).
h (or H) : hour, one or two digits.
hh (or HH) : hour, strictly two digits.
min (or MIN): minutes, one or two digits.
mins (or MINS) : minutes, strictly two digits.
s (or S) : seconds, one or two digits.
ss (or SS) : seconds, strictly two digits.
ampm (or AMPM) : am/pm setting. Valid values to match this token are
am, pm, AM, PM, a.m., p.m., A.M., P.M.
*/
// Be careful with this pattern. Longer tokens should be placed before shorter
// tokens to disambiguate them. For example, parsing "mon_strict" should
// result in one token "mon_strict" and not two tokens "mon" and a literal
// "_strict".
var tokPat=new RegExp("^month_strict|month|Month|MONTH|yyyy|YYYY|mins|MINS|mon_strict|ampm|AMPM|mon|Mon|MON|min|MIN|dd|DD|mm|MM|yy|YY|hh|HH|ss|SS|m|M|d|D|y|Y|h|H|s|S");
// lowerMonArr is used to map months to their numeric values.